Optimal. Leaf size=118 \[ -\frac {2 b \left (2 a^2-b^2\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {\tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 118, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {2881, 3080,
3855, 2738, 211} \begin {gather*} -\frac {2 b \left (2 a^2-b^2\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 d (a-b)^{3/2} (a+b)^{3/2}}+\frac {b^2 \sin (c+d x)}{a d \left (a^2-b^2\right ) (a+b \cos (c+d x))}+\frac {\tanh ^{-1}(\sin (c+d x))}{a^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 2738
Rule 2881
Rule 3080
Rule 3855
Rubi steps
\begin {align*} \int \frac {\sec (c+d x)}{(a+b \cos (c+d x))^2} \, dx &=\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\int \frac {\left (a^2-b^2-a b \cos (c+d x)\right ) \sec (c+d x)}{a+b \cos (c+d x)} \, dx}{a \left (a^2-b^2\right )}\\ &=\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\int \sec (c+d x) \, dx}{a^2}-\frac {\left (b \left (2 a^2-b^2\right )\right ) \int \frac {1}{a+b \cos (c+d x)} \, dx}{a^2 \left (a^2-b^2\right )}\\ &=\frac {\tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x))}-\frac {\left (2 b \left (2 a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^2 \left (a^2-b^2\right ) d}\\ &=-\frac {2 b \left (2 a^2-b^2\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^2 (a-b)^{3/2} (a+b)^{3/2} d}+\frac {\tanh ^{-1}(\sin (c+d x))}{a^2 d}+\frac {b^2 \sin (c+d x)}{a \left (a^2-b^2\right ) d (a+b \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.39, size = 146, normalized size = 1.24 \begin {gather*} \frac {\frac {2 b \left (-2 a^2+b^2\right ) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{3/2}}-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {a b^2 \sin (c+d x)}{(a-b) (a+b) (a+b \cos (c+d x))}}{a^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.38, size = 164, normalized size = 1.39
method | result | size |
derivativedivides | \(\frac {\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2}}-\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2}}-\frac {2 b \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )}+\frac {\left (2 a^{2}-b^{2}\right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2}}}{d}\) | \(164\) |
default | \(\frac {\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2}}-\frac {\ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2}}-\frac {2 b \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )}+\frac {\left (2 a^{2}-b^{2}\right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a^{2}}}{d}\) | \(164\) |
risch | \(-\frac {2 i b \left (a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}{\left (-a^{2}+b^{2}\right ) d a \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}-\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}+\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}+\frac {2 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {b^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,a^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{2} d}\) | \(437\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 262 vs.
\(2 (109) = 218\).
time = 0.65, size = 592, normalized size = 5.02 \begin {gather*} \left [-\frac {{\left (2 \, a^{3} b - a b^{3} + {\left (2 \, a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4} + {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4} + {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (a^{3} b^{2} - a b^{4}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} d \cos \left (d x + c\right ) + {\left (a^{7} - 2 \, a^{5} b^{2} + a^{3} b^{4}\right )} d\right )}}, -\frac {2 \, {\left (2 \, a^{3} b - a b^{3} + {\left (2 \, a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4} + {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4} + {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (a^{3} b^{2} - a b^{4}\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{6} b - 2 \, a^{4} b^{3} + a^{2} b^{5}\right )} d \cos \left (d x + c\right ) + {\left (a^{7} - 2 \, a^{5} b^{2} + a^{3} b^{4}\right )} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (c + d x \right )}}{\left (a + b \cos {\left (c + d x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 198, normalized size = 1.68 \begin {gather*} \frac {\frac {2 \, b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (a^{3} - a b^{2}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b\right )}} - \frac {2 \, {\left (2 \, a^{2} b - b^{3}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{4} - a^{2} b^{2}\right )} \sqrt {a^{2} - b^{2}}} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.98, size = 2886, normalized size = 24.46 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________